($this->config[' deploy '))Using a distributed database$this->_linkid = $this->multiconnect ($master);ElseDefault Single Databaseif (! $this->_linkid) $this->_linkid = $this->connect ();}$this->config[' Deploy ' represents the ' db_deploy_type ' configuration option, the above configuration has been parsed before use, and the configuration items are in the $this->config array. As to how to parse the configuration file, here we do not introduce, inter
class Think\db\dirver
protected function Initconnect ($master =true) { if (!empty ($this->config[' deploy ')) //with distributed database $ This->_linkid = $this->multiconnect ($master); else //default single database if (! $this->_linkid) $this->_linkid = $this->connect ();}
$this->config[' Deploy ' represents the ' db_deploy_type ' configuration option, the above configuration has been parsed before use, and the config
->config[' Hostport '); $_config[' database '] = explode (', ', $this- >config[' database '); $_config[' DSN '] = explode (', ', $this->config[' DSN '); $_config[' CharSet '] = explode (', ', $this->config[' CharSet '));
' Db_deploy_type ' =>1
The 1 representation is distributed, and 0 represents a centralized (that is, a single server).
The implementation of this option is in the class Think\db\dirver
protected function Initconnect ($master =true) { if (!empty ($this->config[' deploy '))
(!empty ($this->config[' deploy '))Using Distributed databases$this->_linkid = $this->multiconnect ($master);ElseDefault Single Databaseif (! $this->_linkid) $this->_linkid = $this->connect ();}
$this->config[' Deploy '] represents the ' db_deploy_type ' configuration option, which has been parsed prior to use, and the configuration items are in the $this->config array. As for how to parse the configuration file, here we do not introduce, interested
Do you need to configure multiple connections or just configure primary RDS?
Reply content:
Do you need to configure multiple connections or just configure primary RDS?
Usually write off the main RDS, read-only RDS.In the case of PHP, the MVC framework is usually just a configuration.such as thinkphp, you can specify the use of an RDS when reading, or a random RDSHere is the code (read the note If you don't understand it):
/** * Connection to distributed server * @access protected * @
Contact Us
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.